<%
Response.ExpiresAbsolute = Now() - 1 
Response.Expires = 0 
Response.CacheControl = "no-cache"

Set x_conn = Server.CreateObject("ADODB.Connection")
x_connStr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/db/hislog.asp")&";Jet OLEDB:Database Password=RGMXT699ThBM26;"
x_conn.Open x_connStr
Set rstObj = Server.CreateObject("ADODB.Recordset")

UserName=Request.Cookies("RG_Report")("RUserName")

rstObj.open "Login_Log",x_conn,3,3
rstObj.AddNew
rstObj("LoginName")=UserName
rstObj("AgentIp")=Request.ServerVariables ("REMOTE_ADDR")
rstObj("LoginTime")=Now
rstObj("SrvName")=ViewPageName
rstObj.Update
rstObj.Close

sqlstr="SELECT * FROM LoginInfo where RealName='"&UserName&"'"
rstObj.open sqlstr,x_conn,3,3
If rstObj.eof Then
	rstObj.AddNew
	rstObj("RealName")=UserName
	rstObj("LastLoginTime")=Now
	rstObj("LastLoginIp")=Request.ServerVariables ("REMOTE_ADDR")
	rstObj("LoginTimes")=1
	rstObj.Update
else
	rstObj("LastLoginTime")=Now
	rstObj("LastLoginIp")=Request.ServerVariables ("REMOTE_ADDR")
	if rstObj("LoginTimes")>0 then rstObj("LoginTimes")=rstObj("LoginTimes")+1 else rstObj("LoginTimes")=1
	rstObj.Update
end if
rstObj.Close

x_conn.close
Set rstObj=nothing
Set x_conn=nothing
%>